<div class="gray_box">
    <div class="cms_title no_border_bottom">
        <div class="inner_blue_title"><?php echo __('Select a File') ?></div>
        <div class="upload_material_text"><?php echo __('Simply select a file from your computer or on the net. We accept many kinds of documents.') ?></div>
        <div class="clear"></div>
    </div>
    <form action="<?php echo url_for('doseyeh/upload_material') ?>" enctype="multipart/form-data" method="post">
        <?php echo $form['_csrf_token'] ?>
        <div class="registration_wrap upload_material_top_wrap">
            <?php if(isset($success)){ ?>
            <br/>
            <div class="notice"><?php echo __('Material uploaded successfully') ?></div>
            <br/>
            <br/>
            <?php } ?>
            <div class="upload_material_top_box">
                <div class="upload_material_grey_area">
                    <div class="upload_file_wrapper">
                        <input checked="checked" type="radio" id="file" name="upload_type" value="file"/>
                        <label for="file"><?php echo __('Upload a File') ?></label>
                    </div>
                    <div class="url_wrapper">
                        <input type="radio" id="url" name="upload_type" value="url"/>
                        <label for="url"><?php echo __('Upload from URL') ?></label>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="upload_material_input_area">
                    <div class="local_file_wrap">
                        <?php echo $form['local_file'] ?>
                        <img src="<?php echo image_path('browse.png') ?>"/>
                        <input type="text" id="fakefile" class="upload_material_large_input"/>
                        <div class="clear"></div>
                        <?php echo $form['local_file']->renderError() ?>
                    </div>
                    <div class="url_wrap">
                        <?php echo $form['url'] ?>
                        <?php echo $form['url']->renderError() ?>
                    </div>
                </div>
                <style>.url_wrap{display:none}</style>
                <script>
                    
                    $('#uploaded_material_local_file').change(function(){
                        $('#fakefile').val($(this).val());
                    });
                    
                    $('#file').click(function(){
                        $('.local_file_wrap').show();
                        $('.url_wrap').hide();
                    });

                    $('#url').click(function(){
                        $('.local_file_wrap').hide();
                        $('.url_wrap').show();
                    });
                </script>
            </div>
            <div class="upload_material_wrapper">
                <table class="upload_material">
                    <tr>
                        <th><?php echo $form['file_name']->renderLabel() ?><?php echo $form['file_name']->renderError() ?></th>
                        <td><?php echo $form['file_name'] ?></td>
                    </tr>
                    <tr>
                        <th><?php echo $form['description']->renderLabel() ?><?php echo $form['description']->renderError() ?></th>
                        <td><?php echo $form['description'] ?></td>
                    </tr>
                    <tr>
                        <th><?php echo $form['material_type']->renderLabel() ?><?php echo $form['material_type']->renderError() ?></th>
                        <td><?php echo $form['material_type'] ?></td>
                    </tr>
                    <tr>
                        <th><?php echo $form['author']->renderLabel() ?><?php echo $form['author']->renderError() ?></th>
                        <td><?php echo $form['author'] ?></td>
                    </tr>
                    <tr>
                        <th><?php echo $form['faculty']->renderLabel() ?><?php echo $form['faculty']->renderError() ?></th>
                        <td><?php echo $form['faculty'] ?></td>
                    </tr>
                    <tr>
                        <th><?php echo $form['university']->renderLabel() ?><?php echo $form['university']->renderError() ?></th>
                        <td><?php echo $form['university'] ?></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right">
                            <input type="image" src="<?php echo image_path('upload_file.png') ?>"/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</div>


